{include 'public/header.html'}

<div class="main-content">

<script>window.UEDITOR_HOME_URL = '{$smarty.const.YD_URL}libraries/ueditor1_4_3_3-utf8-php/';</script>
<script>window.UEDITOR_SERVER_URL = '{$smarty.const.YD_URL}index.php?con=admin/index/ueditor';</script>
<script>window.UEDITOR_REMOVE_URL = '{$smarty.const.YD_URL}';</script>
<script type="text/javascript" charset="utf-8" src="{$smarty.const.YD_URL}libraries/ueditor1_4_3_3-utf8-php/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="{$smarty.const.YD_URL}libraries/ueditor1_4_3_3-utf8-php/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="{$smarty.const.YD_URL}libraries/ueditor1_4_3_3-utf8-php/lang/zh-cn/zh-cn.js"></script>
<script type="text/plain" id="j_ueditorupload" style="height:5px;display:none;"></script>
<script type="text/javascript" charset="utf-8" src="{$smarty.const.YD_URL}libraries/ueditor1_4_3_3-utf8-php/ueditor.upload.js"></script>


<div class="page-content">
  <div class="page-content-area" style="opacity: 0.8;"> <br>
    <div class="page-header">
    {if $row.type != 1}
      <h1> 学校信息 <small><i class="ace-icon fa fa-angle-double-right"></i> 编辑信息 </small> </h1>
    {else}
      <h1> 个人信息 <small><i class="ace-icon fa fa-angle-double-right"></i> 编辑信息 </small> </h1>
    {/if}
    </div>
    <div class="row">
      <div class="panel panel-default">
        <div class="panel-body table-responsive">
          <form method="post" class="form-horizontal" role="form" id="submitform" onsubmit="return false">
			<div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="name">名称</label>
                <input type="text" class="form-control" id="name" name="name" value="{$row.name}" required>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="gname">管理员姓名</label>
                <input type="text" class="form-control" id="gname" name="gname" value="{$row.gname}">
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="email">登陆邮箱</label>
                <input type="text" class="form-control" id="email" name="email" value="{$row.email}" required>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="password">密码</label>
                <input type="text" class="form-control" id="password" name="password" value="{$row.password}" required>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="phone">联系电话</label>
                <input type="text" class="form-control" id="phone" name="phone" value="{$row.phone}">
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="address">所在地址</label>
                <input type="text" class="form-control" id="address" name="address" value="{$row.address}">
              </div>
            </div>
            
            <div class="form-group">
              <input type="hidden" name="video" value="{$row.video}" />
              <div class="col-md-6">
                <label class="control-label">广告视频</label>
                <div class="upfile_filediv">
                  <div class="upfile_filecaption"> <span class="upfile_link">{if $row.video}<a href="{$smarty.const.YD_URL}{$row.video}" target="_blank">{$smarty.const.YD_URL}{$row.video}</a>{/if}</span> <a href="javascript:;" data-type="filediv" class="btn btn-primary btn-xs btn-upfile">上传</a> <a href="javascript:;" data-type="filediv" class="btn btn-default btn-xs btn-upremove">删除</a> </div>
                </div>
              </div>
            </div>
            
            <div class="form-group">
              <div class="col-md-6">
              <label class="control-label">轮播图片</label>
              <textarea name="banner" style="display:none">{$row.banner}</textarea>
                <div class="banner"> {if count($row.banner)}
                  {foreach explode("\n", str_replace("\r", "", $row.banner)) as $k => $v}
                  {if $v}
                  <div class="upfile_imgthumb"> <img src="{$smarty.const.YD_URL}{$v}" data-default="" class="btn-upfile" data-multi="1">
                    <div class="upfile_imgcaption">
                      <a href="javascript:;" data-src="{$smarty.const.YD_URL}{$v}" data-multi="1" class="btn btn-primary btn-xs btn-upfile">上传</a> <a href="javascript:;" data-src="{$smarty.const.YD_URL}{$v}" data-multi="1" class="btn btn-default btn-xs btn-upremove">删除</a> </div>
                  </div>
                  {/if}
                  {/foreach}
                  {/if}
                </div>
                <a href="javascipt:;" class="btn btn-upfile btn-primary btn-sm" style="width:121px" data-multi="1" data-conr=".banner">+ 上传图片</a>
              </div>
            </div>

            <div class="form-group">
              <div class="col-md-6">
                <button type="submit" class="btn btn-primary btn-lg btn-submit">提交</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
var isbusy = false;
$(function(){
	$('#submitform').validate({
		focusInvalid: true,
		rules: {
			//title: {
				//required: true
			//}
		}
	});
	$('.btn-submit').click(function(){
		if(!$('#submitform').valid())return false;
		if(isbusy)return false;
		isbusy = true;
		tooltipbox.show('正在执行操作...');
		$.post(location.href, $('#submitform').serialize(), function(res){
		    if(res.code == 1){
				location.href = '{siteurl("con=admin/index")}';
			}
			tooltipbox.show(res.msg);	
			isbusy = false;
		}, 'json').error(function(a, b, c){
			tooltipbox.show('数据或网络错误');
			isbusy = false;
		});
	});
});
</script> 
{include 'public/footer.html'} 